﻿using System;
using viBlog.Controllers;
using visinia.SmartEngine;

public partial class Admin_Pages_viBlog_Posts_ManagePosts : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void GridViewPOSTS_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {        
        if (e.CommandName == "DeletePost")
        {
            int postId = Convert.ToInt32(e.CommandArgument);            
            PostController.DeletePost(postId);
            CommentController.DeleteComments(postId);
            Response.Redirect(Request.RawUrl);
        }
    }

    public string GetLink(int postid)
    {
        return SystemMenu.CallPage("viBlog", "EditPost", "PostId", postid.ToString());        
    }
    protected void NEW_POST_Click(object sender, EventArgs e)
    {
        Response.Redirect(SystemMenu.CallPage("viBlog", "AddPost"));        
    }
}
